package cn.chuanw.core.util;

import java.math.BigDecimal;
import java.util.Random;

/**
 * @Auther: wangkun
 * @Date:  19-11-13 下午 5:17
 * @Description: 生成指定长度的随机数
 **/
public class RandomNumberUtil {

    public static BigDecimal getBigDecimalRandom(int len) {
        Random r = new Random();
        StringBuilder rs = new StringBuilder();
        for (int i = 0; i < len; i++) {
            rs.append(r.nextInt(10));
        }
        return new BigDecimal(rs.toString());
    }

    public static String getStringRandom(int len) {
        Random r = new Random();
        StringBuilder rs = new StringBuilder();
        for (int i = 0; i < len; i++) {
            rs.append(r.nextInt(10));
        }
        return rs.toString();
    }

}
